# 数学函数
import math

print(math.ceil(1.4), math.ceil(1.8))  # 2 2
print(math.floor(1.4), math.floor(1.8))  # 1 1
print(math.copysign(10, -1))  # -10.0
print(math.fabs(5), math.fabs(-5))  # 5.0 5.0
print(math.factorial(5))  # 120
# print(math.comb(10, 2))

print(math.fmod(10, 3))  # 1.0
print(math.modf(2.3))  # (0.2999999999999998, 2.0)
print(math.frexp(6.25))  # (0.78125, 3) x=m*2**n
print(math.ldexp(2.5, 2))  # 10.0 2.5*(2**2)
print(math.fsum([1, 2, 3, 4]))  # 10.0
print(math.gcd(10, 5))  # 5
print(math.isclose(10, 9.8), math.isclose(10, 9.8, rel_tol=1))  # False True
print(math.isfinite(10), math.isinf(10), math.isnan(10))  # True False False
# print(math.isqrt(9)) # 3
# print(math.lcm(10, 5, 20)) # 20
# print(math.nextafter(10, 11))

print(math.exp(3), math.expm1(3))  # 20.085536923187668 19.085536923187668
print(math.log(16, 4), math.log1p(8), math.log2(16), math.log10(100))  # 2.0 2.1972245773362196 4.0 2.0
print(math.pow(5, 2), math.sqrt(25))  # 25.0 5.0
print(math.cos(0), math.sin(math.pi / 2))  # 1.0 1.0
print(math.acos(0), math.asin(0))  # 1.5707963267948966 0.0
print(math.degrees(math.pi / 2), math.radians(90))  # 90.0 1.5707963267948966
print(math.pi, math.e, math.tau, math.inf, math.nan)  # 3.141592653589793 2.718281828459045 6.283185307179586 inf nan

import cmath

print(cmath.pi, cmath.e, cmath.tau, cmath.inf, cmath.infj, cmath.nan,
      cmath.nanj)  # 3.141592653589793 2.718281828459045 6.283185307179586 inf infj nan nanj
print(cmath.polar(10))  # (10.0, 0.0)
print(cmath.rect(10, 1))  # (5.403023058681398+8.414709848078965j)
print(cmath.exp(2), cmath.log(25, 5), cmath.log10(100), cmath.sqrt(25))  # (7.38905609893065+0j) (2+0j) (2+0j) (5+0j)
print(cmath.isfinite(10 + 1j), cmath.isinf(cmath.infj), cmath.isnan(cmath.nanj),
      cmath.isclose(1 + 1j, 1))  # True True True False

